/**   
 * Copyright © 2018 HIT akeil. Tech Ltd. All rights reserved.
 * 
 * 功能描述：
 * @Package: com.akeil.ui.dialogs 
 * @author: snow   
 * @date: 2018年8月8日 下午11:31:11 
 */
package com.akeil.flash.dialog;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**   
* Copyright: Copyright (c) 2018 HIT akeil
* 
* @ClassName: ChangePasswordDialog.java
* @Description: 该类的功能描述
*
* @version: v1.0.0
* @author: snow
* @date: 2018年8月8日 下午11:31:11 
*
* Modification History:
* Date         Author          Version            Description
*---------------------------------------------------------*
* 2018年8月8日     snow           v1.0.0               修改原因
*/
public class CheckPasswordDialog extends Dialog {
	@Override
	protected void configureShell(Shell newShell) {
		// TODO 自动生成的方法存根
		super.configureShell(newShell);
		newShell.setText("管理员密码");
	}

	private String username = null;
	private String password = null;
	private Text textUsername;
	private Text textPassword;

	public CheckPasswordDialog(Shell parentShell) {
		super(parentShell);
		// TODO Auto-generated constructor stub
	}
	
	@Override
    protected Control createDialogArea(Composite parent) {
        Composite container = (Composite) super.createDialogArea(parent);
        container.setLayout(new FillLayout(SWT.HORIZONTAL));
        
        Composite composite = new Composite(container, SWT.NONE);
        GridLayout gl_composite = new GridLayout(1, false);
        gl_composite.marginTop = 20;
        gl_composite.marginLeft = 30;
        gl_composite.marginRight = 30;
        gl_composite.marginBottom = 30;
        composite.setLayout(gl_composite);
        
        Label label = new Label(composite, SWT.NONE);
        label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        label.setText("用户名");
        
        textUsername = new Text(composite, SWT.BORDER);
        textUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        textUsername.setSize(62, 145);
        
        Label label_1 = new Label(composite, SWT.NONE);
        label_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        label_1.setSize(83, 145);
        label_1.setText("密码");
        
        textPassword = new Text(composite, SWT.BORDER);
        textPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        textPassword.setSize(125, 145);
        textPassword.setEchoChar('*'); // 设置密码用*显示
        
        return container;
    }

	@Override
	protected Point getInitialSize() {
		// TODO Auto-generated method stub
		return new Point(256,265);
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	protected void okPressed() {
		// TODO Auto-generated method stub
		username = textUsername.getText().trim();
		password = textPassword.getText().trim();
		super.okPressed();
	}


}
